<template>
  <!-- 文件上传下达 -->
  <div v-loading="loading" element-loading-text="拼命加载中">
    <el-row>
      <!-- 搜索框 -->
      <el-col :span="24">
        <div class="block">
          <span class="demonstration">文件时间：</span>
          <el-date-picker
                  v-model="value4"
                  type="month"
                  placeholder="选择月">
          </el-date-picker>
        </div>
      </el-col>
      <!-- 按钮区 -->
      <el-col :span="24">
        <div class="button-wrapper">
          <el-button type="success" style="vertical-align:middle;margin-top:10px;margin-left: 5px" round size="mini" @click="dialogFormVisible = true">新增</el-button>
          <el-button type="primary" style="vertical-align:middle;margin-top:10px;margin-left: 5px" round size="mini" @click="">上传文件</el-button>
          <el-button type="info" style="vertical-align:middle;margin-top:10px;margin-left: 5px" round size="mini" @click="">下达文件</el-button>
        </div>
      </el-col>
    </el-row>
    <!-- 表格 -->
    <el-row>
      <el-col :span="24">
        <div class="data-wrapper">
          <template v-if="tableData!=null">
            <el-table ref="multipleTable" :data="tableData"  tooltip-effect="dark" style="width: 100%">
              <el-table-column type="index" label="序号" :index="indexMethod" width="50">
              </el-table-column>
              <el-table-column prop="fileName" label="文件名称" width="250">
              </el-table-column>
              <el-table-column prop="fileUpTime" label="上报时间" width="250">
              </el-table-column>
              <el-table-column prop="fileUpOrganization" label="上报机构" width="250">
              </el-table-column>
              <el-table-column prop="fileUpUser" label="上报人" width="220">
              </el-table-column>
              <el-table-column fixed="right" label="操作" align="center">
                <template slot-scope="scope">
                  <el-button size="mini" type="success" round @click="">查看</el-button>
                  <el-button size="mini" type="primary" round @click="">下载</el-button>
                </template>
              </el-table-column>
            </el-table>
          </template>
        </div>
      </el-col>
    </el-row>
    <!-- 底部按钮和分页 -->
    <el-row :gutter="20" v-if="dataCount" type="flex" justify="space-between" align="center" class="page-wrapper">
      <el-col :span="24">
        <div class="page-item">
          <el-pagination background
                         @size-change="handleSizeChange"
                         @current-change="handleCurrentChange"
                         :current-page.sync="listQuery.currentPage"
                         :page-sizes="pageSizes"
                         :page-size="listQuery.pageSize"
                         layout="total, sizes, prev, pager, next, jumper"
                         :total="dataCount"/>
        </div>
      </el-col>
    </el-row>
  </div>
</template>
<script>
    export default {
        data(){
            return {
                value4:"",
                tableData:[{
                    fileName:"红心整改文件",
                    fileUpTime:"2018/1/12",
                    fileUpOrganization:"红心社",
                    fileUpUser:"郑伊健"
                },{
                    fileName:"红心整改文件",
                    fileUpTime:"2018/1/12",
                    fileUpOrganization:"红心社",
                    fileUpUser:"郑伊健"
                },{
                    fileName:"红心整改文件",
                    fileUpTime:"2018/1/12",
                    fileUpOrganization:"红心社",
                    fileUpUser:"郑伊健"
                }],
                loading:false,
                //默认数据总数
                dataCount:0,
                pageSizes:[5, 10, 20, 30, 40],
                //查询条件
                listQuery: {
                    currentPage:1,
                    pageSize:5,
                    releaseTime:[]
                },
            }
        },
        created() {
            // this.getList();
        },
        methods:{
            getList() {
                this.loading=true;
                this.postRequest('/api/rcs/riverNewss',this.listQuery).then((res)=>{
                    var data = res.data;
                    if(data.status == 200){
                        console.log(data.data)
                        this.tableData=data.data
                        this.dataCount=data.count;
                        this.loading = false;
                    }else{
                        this.$message.error(data.msg);
                    }
                })
                    .catch((error)=>{
                        //错误信息
                        this.$message.error(error)
                    })
            },
            indexMethod(index) {
                return (index+1)+(this.listQuery.currentPage-1)*this.listQuery.pageSize;
            },
            handleSizeChange(size) {
                this.listQuery.pageSize=size;
                this.listQuery.currentPage=1;
                this.getList()
            },
            handleCurrentChange(currentPage) {
                this.listQuery.currentPage=currentPage;
                this.getList()
            },
        },
        mounted(){},
        updated(){},
        destroyed(){},
    }
</script>
<style scoped>

</style>